/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package toesp.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author satria.sp
 */
@Entity
@Table(name = "groupmenu")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Groupmenu.findAll", query = "SELECT g FROM Groupmenu g")})
public class Groupmenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "groupmenu_id")
    private Integer groupmenuId;
    //-------------------------------------------------------------------------- 
    @Basic(optional = false)
    @Column(name = "group_id")
    private Integer groupId;  
    @Basic(optional = false)
    @Column(name = "menu_id")
    private Integer menuId;
    //--------------------------------------------------------------------------
    @JoinColumn(name = "group_id", referencedColumnName = "group_id", insertable=false, updatable=false)
    @ManyToOne
    private Grouppermission grouppermission;
    @JoinColumn(name = "menu_id", referencedColumnName = "menu_id", insertable=false, updatable=false)
    @ManyToOne
    private Menu menu;

    public Groupmenu() {
    }

    public Groupmenu(Integer groupmenuId) {
        this.groupmenuId = groupmenuId;
    }

     

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getGroupmenuId() != null ? getGroupmenuId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Groupmenu other = (Groupmenu) obj;
        if (this.getGroupId() != other.getGroupId() && (this.getGroupId() == null || !this.groupId.equals(other.groupId))) {
            return false;
        }
        if (this.getMenuId() != other.getMenuId() && (this.getMenuId() == null || !this.menuId.equals(other.menuId))) {
            return false;
        }
        return true;
    }

    /**
     * @return the groupmenuId
     */
    public Integer getGroupmenuId() {
        return groupmenuId;
    }

    /**
     * @param groupmenuId the groupmenuId to set
     */
    public void setGroupmenuId(Integer groupmenuId) {
        this.groupmenuId = groupmenuId;
    }

    /**
     * @return the groupId
     */
    public Integer getGroupId() {
        return groupId;
    }

    /**
     * @param groupId the groupId to set
     */
    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    /**
     * @return the menuId
     */
    public Integer getMenuId() {
        return menuId;
    }

    /**
     * @param menuId the menuId to set
     */
    public void setMenuId(Integer menuId) {
        this.menuId = menuId;
    }

    /**
     * @return the grouppermission
     */
    public Grouppermission getGrouppermission() {
        return grouppermission;
    }

    /**
     * @param grouppermission the grouppermission to set
     */
    public void setGrouppermission(Grouppermission grouppermission) {
        this.grouppermission = grouppermission;
    }

    /**
     * @return the menu
     */
    public Menu getMenu() {
        return menu;
    }

    /**
     * @param menu the menu to set
     */
    public void setMenu(Menu menu) {
        this.menu = menu;
    }
}
